package yueyong.salarymanagement.module.business.salary.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import yueyong.salarymanagement.common.anno.NoValidPrivilege;
import yueyong.salarymanagement.common.domain.ResponseDTO;
import yueyong.salarymanagement.constant.SwaggerTagConst;
import yueyong.salarymanagement.module.business.salary.domain.dto.CompanyAddDTO;
import yueyong.salarymanagement.module.business.salary.domain.dto.CompanyUpdateDTO;
import yueyong.salarymanagement.module.business.salary.domain.vo.CompanyVO;
import yueyong.salarymanagement.module.business.salary.service.CompanyService;
import yueyong.salarymanagement.module.system.role.basic.domain.dto.RoleAddDTO;
import yueyong.salarymanagement.module.system.role.basic.domain.dto.RoleUpdateDTO;

import javax.validation.Valid;
import java.util.List;

/**
 * Copyright: yueyong (c) 2022
 *
 * @author he.shaorong
 * @version 1.0
 * @date 2022/1/26
 */
//@RestController
//@Api(tags = {SwaggerTagConst.Admin.BUSINESS})
public class CompanyController {

    @Autowired
    private CompanyService companyService;


    @GetMapping("/test/queryCompanyData/{companyId}")
    @ApiOperation(value = "test company", notes = "test company")
    @NoValidPrivilege
    public ResponseDTO<List<CompanyVO>> getTestValue(@PathVariable int companyId) {
        return ResponseDTO.succData(companyService.queryAllExportData(companyId));
    }

    @GetMapping("/test/queryCompanyData2/{companyId}")
    @ApiOperation(value = "test company2", notes = "test company2")
    @NoValidPrivilege
    public ResponseDTO<CompanyVO> getTestValue2(@PathVariable int companyId) {
        return ResponseDTO.succData(companyService.queryAllExportData2(companyId).get(0));
    }

    @ApiOperation(value = "添加公司", notes = "设置公司")
    @PostMapping("/test/company/add")
    public ResponseDTO addCompany(@Valid @RequestBody CompanyAddDTO companyAddDTO) {
        return companyService.addCompany(companyAddDTO);
    }

    @ApiOperation(value = "更新公司", notes = "更新公司ss")
    @PostMapping("/test/company/update")
    public ResponseDTO<String> updateRole(@Valid @RequestBody CompanyUpdateDTO companyUpdateDTO) {
        return companyService.updateCompany(companyUpdateDTO);
    }
}
